# $Id: PKGBUILD 63766 2012-02-05 12:13:13Z ibiru $
# Maintainer: Daenyth
# Contributor: Eric Belanger <belanger@astro.umontreal.ca>
# Contributor: Shahar Weiss <sweiss4@gmx.net>
# Contributor: Alexander Rødseth <rodseth@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patches to fix FTBFS: 1.7.2-debugger.patch 1.7.2-util.patch

pkgname=visualboyadvance
pkgver=1.7.2
pkgrel=9.1
pkgdesc="Emulator for Gameboy and Gameboy Advance systems"
arch=('x86_64' 'i686')
url="http://vba.ngemu.com/"
license=("GPL")
depends=('libglademm' 'sdl')
makedepends=('nasm')
backup=('etc/VisualBoyAdvance.cfg')
source=("http://downloads.sourceforge.net/sourceforge/vba/VisualBoyAdvance-src-$pkgver.tar.gz"
        '1.7.2-deprecatedsigc++.patch' '1.7.2-gcc34.patch' '1.7.2-gcc41.patch'
	      '1.7.2-glibc.patch' '1.7.2-homedir.patch' '1.7.2-uninit.patch' '1.7.2-debugger.patch' '1.7.2-util.patch')
md5sums=('cc02339e3fd8efd9f23121b0a2f81fd8'
         '95596fbe499c23b8154142b5789cd630'
         'e7c816ac1adf832c8bd3f6b899d6b935'
         '22c90f2d75856c8407f70b19038105a4'
         'e7a5188b483e2c4d2fee2a5efb088908'
         'ef02d9be59ab74afa9a8f12e17e359d4'
         '004c269a9cdbfa0f4b7fd51978f78705'
         'db64f9d34f0b642b254c44ddaafa553b'
         '2ae89e9a858bc396891340d0308a794b')

build() {
  cd "$srcdir/VisualBoyAdvance-$pkgver"

  sed -i 's:setjmp(png_ptr->jmpbuf):1+1==3:' src/Util.cpp

  patch -Np0 < "$srcdir/$pkgver-homedir.patch"
  patch -Np0 < "$srcdir/$pkgver-gcc34.patch"
  patch -Np0 < "$srcdir/$pkgver-gcc41.patch"
  patch -Np0 < "$srcdir/$pkgver-deprecatedsigc++.patch"
  patch -Np0 < "$srcdir/$pkgver-uninit.patch"
  patch -Np0 < "$srcdir/$pkgver-glibc.patch"
  patch -Np1 -i ../1.7.2-debugger.patch
  patch -Np0 -i ../1.7.2-util.patch
  ./configure --prefix=/usr --sysconfdir=/etc --enable-gtk=2.4
  make
}

package() {
  cd "$srcdir/VisualBoyAdvance-$pkgver"

  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
